using IQIGame.Onigao.GamePlay;

namespace IQIGame.Onigao.Logic
{
    public class ExecLeaveLevel : BaseServiceExecution
    {
        public override void Execute(LevelRegion region, LevelPlayer player)
        {
            if (player.entity.isOccupied)
            {
                LogicLog.LogError("离开关卡错误，玩家处于被占用状态。");
                return;
            }
            if (!player.level.Save(player))
            {
                return;
            }
            var config = _config as ExecParamLeaveLevel;
            SLevelLogicModule.Instance.LeaveLevel(player, config.outRegionCid, config.outPortalMcid, 0, true);
        }
    }
}
